import { defineStore } from 'pinia'
export const useNoteStore = defineStore({
  // id 是必填的，并且所有 Store 中唯一。因为Pinia会将它在devtools显示
  id: 'NoteStore',
  state: () => ({
    note: {
      /*Pat_Id:'1',
            Pat_No:'000000120',
            Pat_Name:'赵云',
            Pat_Sex:'男',
            Pat_IdNo:'510524199004141396',
            Pat_Address:'四川省成都市双流区',
            Pat_Birthday:'1990-04-14',
            Pat_PhoneNumber:'15982097368',
            Adm_Id:'1024',//ID
            Adm_DepId:'1',//就诊科室ID
            Adm_DepName:'骨科',//就诊科室
            Adm_DocName:'刘备',//就诊医生
            Adm_Type:'门诊',//就诊类型
            Adm_Date:'2022-10-18',//就诊日期/入院日期
            Adm_Diag:[
                {Diag_Key:'1',Diag_Type:'门诊诊断',Diag_Stage:'初步诊断',Diag_Code:'A0.19.Z',Diag_Desc:'骨折',Diag_Date:'2022-10-18',Diag_Main:'Y',Diag_State:'生效'}
            ]
            */
    },
    note_key: '',
  }),
  /**
   * 用来封装计算属性 有缓存功能  类似于computed
   */
  getters: {},
  /**
   * 编辑业务逻辑  类似于methods
   */
  actions: {
    INIT_NOTE: function () {
      this.note = {}
    },
    SET_NOTE: function (note: any) {
      this.note = note
    },
    GET_NOTE: function (): Object {
      return this.note
    },
    SET_NOTE_KEY: function (key: any) {
      this.note_key = key
    },
    GET_NOTE_KEY: function () {
      //通过监听NOTE_KEY 初始化NOTE内容
      //将NOTE内容放到组件里面去处理
      return this.note_key
    },
  },
})
